import React, { Component } from 'react'
import styles from "./Header.module.scss"
import {withRouter} from "react-router-dom"

class Header extends Component {
    state={
        dir:"category"
    }
    handleClick=(dir) => {
        return ()=>{
            console.log(dir);
            this.setState({
                dir:dir,
            })
            this.props.history.push(`/${dir}`)
        }
        
    }
    
    
    render() {
        return (
            <div className={styles.c_header}>
                <h1 className={this.state.dir==="category"?styles.active:""} onClick={this.handleClick("category")}>分类</h1>
            </div>
        )
    }
}
export default withRouter(Header);